define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'coupon.deploy/index',
        add_url: 'coupon.deploy/add',
        edit_url: 'coupon.deploy/edit',
        delete_url: 'coupon.deploy/delete',
        export_url: 'coupon.deploy/export',
        modify_url: 'coupon.deploy/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},                    {field: 'id', title: 'id'},                    {field: 'name', title: '优惠卷名称'},                    {field: 'use_type', search: 'select', selectList: ["平台通用","店铺专用","商品类型专用"], title: '使用分类'},                    {field: 'uset_threshold', search: 'select', selectList: ["无门槛","满减","打折"], title: '优惠门槛'},                    {field: 'discount', title: '折扣力度'},                    {field: 'acme', title: '满减达到限制'},                    {field: 'state', search: 'select', selectList: ["可用","禁用"], title: '状态'},                    {width: 250, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});